package prist;

import java.util.*;

public class Resource_Managenment {
    //定义银行家所拥有的资源种类和数目
    public static Map<Object, Integer> resource;
    //定义银行家所剩于的资源数目
    public static Map<Object, Integer> live_resource;

    //初始化银行家管理的资源
    public Resource_Managenment() {
        Scanner sc = new Scanner(System.in);
        resource = new HashMap<Object, Integer>();
        live_resource = new HashMap<Object, Integer>();
        Integer resource_Number;
        int count;      //银行家拥有的资源种类数目
        System.out.print("银行家拥有的资源的种类数: ");
        count = sc.nextInt();
        System.out.println("请输入银行家所拥有的资源种类和数目(eg:A 2)");
        String resource_Kind;
        //初始化资源 个数与种类
        for (int i = 0; i < count; i++) {
            resource_Kind = sc.next();
            resource_Number = sc.nextInt();
            resource.put(resource_Kind, resource_Number);
            live_resource.put(resource_Kind, resource_Number);
        }
        System.out.println("输出初始化内容");
        //Set<Map.Entry<Object,Object>>entrySet=resource.entrySet();
        for (Map.Entry<Object, Integer> entry : resource.entrySet()) {
            System.out.println("Kind: " + entry.getKey() + "\t" + "number: " + entry.getValue());
        }
    }

    public static Map<Object, Integer> getResource() {
        return resource;
    }

    public static void setResource(Map<Object, Integer> resource) {
        Resource_Managenment.resource = resource;
    }

    public static Map<Object, Integer> getLive_resource() {
        return live_resource;
    }

    public static void setLive_resource(Map<Object, Integer> live_resource) {
        Resource_Managenment.live_resource = live_resource;
    }
}


